<?php
$numeros = $data[0];
$entradas = $data[1];
?>

<div class="mws-report-container clearfix">

    <!-- Statistic Item -->
    <a class="mws-report" href="#">
        <!-- Statistic Icon (edit to change icon) -->
        <span class="mws-report-icon mws-ic ic-chart-curve-add"></span>

        <!-- Statistic Content -->
        <span class="mws-report-content">
            <span class="mws-report-title">Entradas do mês</span>
            <span class="mws-report-value up"><?php echo number_format($numeros[0], 2); ?></span>
        </span>
    </a>

    <a class="mws-report" href="#">
        <!-- Statistic Icon (edit to change icon) -->
        <span class="mws-report-icon mws-ic ic-chart-curve-delete"></span>

        <!-- Statistic Content -->
        <span class="mws-report-content">
            <span class="mws-report-title">Saidas do mês</span>
            <span class="mws-report-value down"><?php echo number_format($numeros[1], 2); ?></span>
        </span>
    </a>

    <a class="mws-report" href="#">
        <!-- Statistic Icon (edit to change icon) -->
        <span class="mws-report-icon mws-ic ic-coins"></span>

        <!-- Statistic Content -->
        <span class="mws-report-content">
            <span class="mws-report-title">Dízimos do mês</span>
            <span class="mws-report-value up"><?php echo number_format($numeros[2], 2); ?></span>
        </span>
    </a>

    <a class="mws-report" href="#">
        <!-- Statistic Icon (edit to change icon) -->
        <span class="mws-report-icon mws-ic ic-share"></span>

        <!-- Statistic Content -->
        <span class="mws-report-content">
            <span class="mws-report-title">Ofertas do mês</span>
            <span class="mws-report-value up"><?php echo number_format($numeros[3], 2); ?></span>
        </span>
    </a>

    <a class="mws-report" href="#">
        <!-- Statistic Icon (edit to change icon) -->
        <span class="mws-report-icon mws-ic ic-tag-blue-add"></span>

        <!-- Statistic Content -->
        <span class="mws-report-content">
            <span class="mws-report-title">Outras ofertas</span>
            <span class="mws-report-value up"><?php echo number_format($numeros[4], 2); ?></span>
        </span>
    </a>
    <a class="mws-report" href="#">
        <!-- Statistic Icon (edit to change icon) -->
        <span class="mws-report-icon mws-ic ic-coins-add"></span>

        <!-- Statistic Content -->
        <span class="mws-report-content">
            <span class="mws-report-title">Saldo atual</span>
            <span class="mws-report-value"><?php echo number_format($numeros[5], 2); ?></span>
        </span>
    </a>
</div>

<div class="mws-panel grid_4">
    <div class="mws-panel-header">
        <span>Suas entradas</span>
    </div>
    <div class="mws-panel-body">
            <table class="mws-datatable mws-table">
                <thead>
                    <tr>
                        <th>Data</th> 
                        <th>Descrição</th> 
                        <th>Pagamento</th> 
                        <th>Valor</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $arrayEntrada = [];
                    foreach ($entradas as $entrada) {
                        echo "<tr class='gradeX'>";
                        echo "<td>" . $entrada->data . "</td>";
                        echo "<td>" . $entrada->beanTipoEntrada->descricao . "</td>";
                        echo "<td>" . $entrada->beanTipoPagamento->tipoPagamento . "</td>";
                        echo "<td>" . number_format($entrada->valor, 2) . "</td>";
                        echo "</tr>";

                        $arrayEntrada[] = $entrada->beanTipoEntrada->codigo;
                    }
                    
                    if(count($entradas) == 0){
                        echo "<tr><td>Você ainda não possui nenhum dízimo ou oferta!</td></tr>";
                    }
                    ?>
                    
                </tbody>
            </table>
    </div>
</div>